<template>
  <div v-show="total > 0" class="pagination-container">
    <el-pagination
      :current-page="page"
      :page-size="limit"
      :total="total"
      :page-sizes="[10, 20, 30, 50]"
      background
      layout="total, sizes, prev, pager, next, jumper"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    ></el-pagination>  
  </div>
</template>

<script>
export default {
  name: 'Pagination',
  props: {
    total: {
      type: Number,
      default: 0
    },
    page: {
      type: Number,
      default: 1
    },
    limit: {
      type: Number,
      default: 10
    }
  },
  methods: {
    handleSizeChange(val) {
      this.$emit('update:limit', val)
      this.$emit('pagination')
    },
    handleCurrentChange(val) {
      this.$emit('update:page', val)
      this.$emit('pagination')
    }
  }
}
</script>

<style scoped>
.pagination-container {
  padding: 20px 16px;
}
</style>
